package com.jyu.hakkatranslation.controller;

import com.jyu.hakkatranslation.commons.model.ReturnObject;
import com.jyu.hakkatranslation.pojo.Thesis;
import com.jyu.hakkatranslation.service.ThesisService;
import io.minio.RestoreObjectArgs;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Akihi
 * @create 2023/01/07 17:53
 */
@RestController
@Slf4j
@RequestMapping("/thesis")
public class ThesisController {
    @Autowired
    private ThesisService thesisService;

    @GetMapping("/all")
    public ReturnObject all(){
        List<Thesis> list = thesisService.all();
        return ReturnObject.success(list);
    }

    @GetMapping("/{id}")
    public ReturnObject getById(@PathVariable Long id){
        Thesis thesis = thesisService.getById(id);
        return ReturnObject.success(thesis);
    }
}
